#ifndef DBCONNECTPOOL_H
#define DBCONNECTPOOL_H

#include <QObject>
#include <QSqlDatabase>
#include <QMutex>
#include <QSqlQuery>
#include <QMap>

class DbConnectManager : public QObject
{
    Q_OBJECT
public:
    explicit DbConnectManager(QObject *parent = nullptr);
    ~DbConnectManager();
    static DbConnectManager *getInstance();
    bool init(QString strDbFilename);

    enum SynMode{
        Full = 0,
        Normal,
        Off,
    };
    bool setSynMode(SynMode mode);
    QSqlDatabase *getDbConnection();

private:
    QString m_strDbFilename;
    QMap<QString,QSqlDatabase *> m_mapDataBase; //<connectName,db>
};

#endif // DBCONNECTPOOL_H
